<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
?><div class="user-body">
  	<div class="body-content">
      <div class="money-form">
     	<form action="<?php echo site_url('item_lock/insert');?>" method="post" id="form_id">
      	<table cellspacing=0 cellpadding=0 border=0>
      		<tr><th>项目列表：</th>
	      		<td>
		      		<select name="item_id" id="item_id">
			      		
<?php
foreach ($items as $v) {
?>			      		<option value="<?php echo $v['id'];?>"><?php echo $v['name'];?></option>
			      		<?php
}

?>		      		</select>
		      		
	      		</td>
      		</tr>
   			<tr><th>投资单价：</th><td><input type="text" name="price" disabled></td></tr>
      		<tr><th>投资数量：</th><td><input type="text" name="amount" must="1"><p>请输入投资数量</p></td></tr>
      		<tr><th></th><td>您当前余额：<span id="balance">---</span> 最大可购买：<span id="can">---</span>个</td></tr>
      		<tr><th>投资总额：</th><td><input type="text" name="total" disabled></td></tr>
      		<tr><th>安全密码：</th><td><input type="password" name="paypwd" must="1"><p>请输入安全密码</p></td></tr>
      		<tr><th></th><td class="warning"></td></tr>
      		<tr><th></th><td><button type="submit">提交</button></td></tr>
      	</table>
      	</form>
      </div>
     
      <script>
		$(function(){
			$('#form_id').checkForm();
			$('[name="amount"],[name="price"]').bind('change keyup',function(d){
				var amount = $('[name="amount"]').val();
				var price = $('[name="price"]').val();
				$('[name="total"]').val(Number(amount)*Number(price));
			});
		})
      </script>
      
      <div class="list">
      	<table cellspacing=0 cellpadding=0 border=0>
			<thead>
				<tr>
					<th>编号</th>
					<th>项目</th>
					<th>数量</th>
					<th>单价</th>
					<th>冻结</th>
					<th>时间</th>
					<th>状态</th>
				</tr>
			</thead>
			<tbody>
			    
<?php
foreach ($list as $v) {
?>				<tr>
					<td><?php echo $v['id'];?></td>
					<td><?php echo $v['item']['name'];?></td>
					<td><?php echo $v['amount'];?></td>
					<td><?php echo $v['item']['db_rate'];?> <?php echo $v['coin']['en_name'];?></td>
					<td><?php echo $v['amount'];?></td>
					<td><?php echo date('Y-m-d H:i', $v['add_time']);?></td>
					<td>
						
<?php
	if ($v['stat'] == 0) {
?>冻结中<?php
	}

?>						
<?php
	if ($v['stat'] == 1) {
?>已解冻<?php
	}

?>					</td>
				</tr>
				<?php
}

?>			</tbody>
		</table>
		<div class="page">
		  <?php echo $page;?>		</div>
		
<?php
if (!$list) {
?>		<div class="not-list">
			<i class="fa fa-ban"></i>
			<span><?php echo lang('user_not_list');?></span>
		</div>
		<?php
}

?>		<div class="clear"></div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
</div>
<script type="text/javascript">
$(function(){
	$.post('<?php echo site_url('item_lock/balance');?>',{'item_id':<?php echo $items[0]['id'];?>},function(d){
		d = eval('('+d+')');
		$('#balance').text(d.xnb);
		$('#can').text(d.can);
	});
	$('#item_id').on('change',function(){
		var v = $(this).val();
		$.post('<?php echo site_url('item_lock/balance');?>',{'item_id':v},function(d){
			d = eval('('+d+')');
			$('#balance').text(d.xnb);
			$('#can').text(d.can);
		});
	});
});
      		</script>